{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "f1fad78d",
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "a5e1a640",
   "metadata": {},
   "outputs": [],
   "source": [
    "ckpt1 = torch.load(\"logs/ljs_mb_istft_vits/G_43000.pth\",map_location=\"cpu\")\n",
    "ckpt2 = torch.load(\"logs/pretrained.pth\",map_location=\"cpu\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "80d05fa6",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "7eed0847",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "3ef57b92",
   "metadata": {},
   "outputs": [],
   "source": [
    "for k in ckpt1[\"model\"].keys():\n",
    "    if \"dec\" in k:\n",
    "        ckpt1[\"model\"][k] = ckpt2[\"model\"][k]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "df22cbf6",
   "metadata": {},
   "outputs": [],
   "source": [
    "torch.save(ckpt1, \"logs/ljs_mb_istft_vits/G_1000000.pth\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "db728c0f",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}